package com.heima.dao;

import com.heima.domain.Book;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface BookDao {
    @Select("select * from weblogin.tbl_book")
    List<Book> findAll();

    @Select("select * from weblogin.tbl_book where id=#{id}")
    Book findByid(Integer id);

    @Insert("INSERT INTO weblogin.tbl_book VALUES (null,#{type},#{name},#{description})")
    Boolean save(Book book);

    @Update("update weblogin.tbl_book set type=#{type},name=#{name},description=#{description} where id = #{id}")
    Boolean update(Book book);

    @Delete("delete from weblogin.tbl_book where id = #{id}")
    Boolean delete(Integer id);
}
